package com.erp.util;

import java.util.List;

import com.erp.dto.Department;

public class DepartmentUtils {

	/**
	 * 根据原始部门List获取格式化以后的部门List
	 * @param departmentList
	 * @return
	 */
	public static List<Department> getDepartmentTree(
			List<Department> departmentList) {
		String prefix = "━";
		String suffix = "┫";
		String name = "";
		Integer count = 0;
		for (Department temp : departmentList) {
			name = suffix + temp.getName();
			count = temp.getLevel();
			while (count > 1) {
				name = prefix + name;
				count--;
			}
			temp.setName(name);
		}
		return departmentList;
	}

}
